package com.ruoyi.bus.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bus.mapper.WitPlanMapper;
import com.ruoyi.bus.domain.WitPlan;
import com.ruoyi.bus.service.IWitPlanService;

/**
 * 排班计划Service业务层处理
 * 
 * @author caiyanshan
 * @date 2021-04-17
 */
@Service
public class WitPlanServiceImpl implements IWitPlanService 
{
    @Autowired
    private WitPlanMapper witPlanMapper;

    /**
     * 查询排班计划
     * 
     * @param planId 排班计划ID
     * @return 排班计划
     */
    @Override
    public WitPlan selectWitPlanById(Long planId)
    {
        return witPlanMapper.selectWitPlanById(planId);
    }

    /**
     * 查询排班计划列表
     * 
     * @param witPlan 排班计划
     * @return 排班计划
     */
    @Override
    public List<WitPlan> selectWitPlanList(WitPlan witPlan)
    {
        return witPlanMapper.selectWitPlanList(witPlan);
    }

    /**
     * 新增排班计划
     * 
     * @param witPlan 排班计划
     * @return 结果
     */
    @Override
    public int insertWitPlan(WitPlan witPlan)
    {
        witPlan.setCreateTime(DateUtils.getNowDate());
        return witPlanMapper.insertWitPlan(witPlan);
    }

    /**
     * 修改排班计划
     * 
     * @param witPlan 排班计划
     * @return 结果
     */
    @Override
    public int updateWitPlan(WitPlan witPlan)
    {
        return witPlanMapper.updateWitPlan(witPlan);
    }

    /**
     * 批量删除排班计划
     * 
     * @param planIds 需要删除的排班计划ID
     * @return 结果
     */
    @Override
    public int deleteWitPlanByIds(Long[] planIds)
    {
        return witPlanMapper.deleteWitPlanByIds(planIds);
    }

    /**
     * 删除排班计划信息
     * 
     * @param planId 排班计划ID
     * @return 结果
     */
    @Override
    public int deleteWitPlanById(Long planId)
    {
        return witPlanMapper.deleteWitPlanById(planId);
    }
    
    public int updateWitPlanStatus(){
        return witPlanMapper.updateWitPlanStatus();
    }
    
    public List<WitPlan> todayPlan(String dept){
        return witPlanMapper.todayPlan(dept);
    }

    public List<WitPlan> listHomePlanRecord(Long userId){
        return witPlanMapper.listHomePlanRecord(userId);
    }
}
